<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>投诉建议</title>
    <link rel="stylesheet" href="../../css/amazeui.min.css">
    <link rel="stylesheet" href="css/app.css">
    <style>

    </style>
</head>
<body>


<div id='header' class="am-g am-topbar-fixed-top" >
	<div  onclick="api.closeWin();"  class="am-u-sm-2" style="margin-top:12px;padding-left: 17px">
		<img  src="images/arr-l.png" style="height:14px;height: 18px;"/>
	</div> 
	<div class="am-u-sm-8 til" style="margin-top:13px;text-align:center;">
		<h1>投诉建议</h1>
	</div>
	<div class="am-u-sm-2" style="font-size: 20px;margin-top:10px;color:white;text-align:center;">

   </div>
</div>


<div class="am-g" style="margin-top: 50px">
	<img src="images/property/fk.jpg" width="100%"/>
</div>

<div class="am-g">
	
		 <div class="am-u-sm-12" style="margin-top:10px;">
	   	    <form class="am-form am-form-horizontal">
	          <div class="am-form-group">
	            <label for="name" class="am-u-sm-3 am-form-label">标题 </label>
	            <div class="am-u-sm-9">
	              <input type="text" id="title" value="" placeholder="标题 ">
	            </div>
	          </div>
	          
	          <div class="am-form-group">
	            <label for="name" class="am-u-sm-3 am-form-label">内容 </label>
	            <div class="am-u-sm-9">
	              <textarea id="content" placeholder="内容 "></textarea>
	            </div>
	          </div>
	          
	
	          <div class="am-form-group">
	            <label  class="am-u-sm-3 am-form-label">类别</label>
	            <div class="am-u-sm-9">
		              <div class="am-btn-group doc-js-btn-1"   data-am-button>
		                   
		                   <!--am-active-->
						  <label class="am-btn am-btn-warning">
						    <input type="radio" name="category" value="表扬" >表扬
						  </label>
						  <label class="am-btn am-btn-warning">
						    <input type="radio" name="category" value="批评" >批评
						  </label>
						  <label class="am-btn am-btn-warning">
						    <input type="radio" name="category" value="建议" >建议
						  </label>
					  </div>
	            </div>
	          </div>
	
	         
	        </form>
	   	   
	   	   
	   </div>
</div>





<div class="am-g" style="margin-top:15px;">
  <div class="am-u-sm-12">
		<input type="button"  onclick="addAdvise();"  style="border-radius:5px;"  value="提交" class="am-btn-block am-btn am-btn-warning am-btn-sm">
  </div>
</div>

	
	
	
	
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>

<script type="text/javascript">
   apiready=function(){
          
   
   };
   
   //提交建议
   function addAdvise(){
        var title=$api.byId('title').value;
		var content=$api.byId('content').value;
		
		if(title==''){
			 alert('请输入标题！');
			 return;
		}
		if(content==''){
			 alert('请输入内容！');
			 return;
		}
		
		var radio = document.getElementsByName("category");
		var category = "";
		
		for (var i = 0; i < radio.length; i++) {
			if (radio[i].checked) {
				category = radio[i].value;
			}
		}
		
		if(category==''){
			 alert('请选择类别！');
			 return;
		}
		
		api.showProgress({
	        title: '正在提交...',
	        modal: false
    	});
    	
    	var account = $api.getStorage('account');
    	
		var member2 = $api.getStorage('member2');
    	var nickName = member2.nickName;
    	var memberName = account;
    	var compounds = member2.compounds;

		var getUrl = "http://www.72gs.net/app/addAdvise?title=" + title + "&nickName=" + nickName + "&memberName=" + memberName + "&compounds=" + compounds +
		 "&category=" + category + "&content=" + content + "&address=" + member2.address + "&unitName=" + member2.unitName + "&roomNumber=" + member2.roomNumber;

		api.ajax({
	        url: getUrl,
	        method: 'post',
	        cache: false,
	        timeout: 20,
	        //data:{'account':account,'password':password},
	        headers: {
	            "Content-type": "application/json;charset=UTF-8"
	        }
	    }, function (ret, err) {
	    	 if (ret.resultCode == '0') {
				alert('提交成功');
	        	
	            setTimeout(function () {
	                api.closeWin();
	            }, 100);
	        } else {
	        	alert("操作失败！");
	            api.alert({
	                msg: err.msg
	            });
			 	 $api.attr($api.byId("textmsg"),'value','登陆信息错误!');
	        }
	        api.hideProgress();
	    });
   };

</script>



</html>